<?php
class selectdivWidget extends CWidget {
    public $type = "gold";
    public $inputId = "server";
    public $slider_id = 'slider_id';
    public $slider_content = 'games';
    public $selectSub = "selectSub";
    public function run() {
        //注册需要的js
        $basePath = Yii::getPathOfAlias('application.extensions.selectdiv');
        $baseUrl = Yii::app()->getAssetManager()->publish($basePath);
        $cs = Yii::app()->getClientScript();
        $cs->registerCoreScript('jquery');
        $cs->registerCssFile($baseUrl . '/css/style.css');
        $cs->registerScriptFile($baseUrl . '/js/main.js', CClientScript::POS_END);
        $cs->registerScriptFile($baseUrl . '/js/jquery.bgiframe.js', CClientScript::POS_END);
        //单选多选按钮判断  $vo->linkurl   $vo->imgurl
        if($this->type!='gold'){
           $scriptStr = '
               $("#'.$this->slider_id.'").selectCity("#'.$this->slider_content.'");
               setFilter("'.$this->selectSub.'");
                function setGameVal(_seft,obj){
                    $(_seft).val($(obj).attr("title"));
                    $("#"+ $(_seft).attr("id")+"-value").val($(obj).attr("rel"));
                }
               '; 
           Yii::app()->clientScript->registerScript($this->slider_id, $scriptStr, CClientScript::POS_END);
        }
    }
}